<template>
    <view class="container">
        <view class="list">
            <view class="list-item" v-for="(item, __i0__) in list" :key="__i0__">
                <view class="list-body">
                    <view class="action">{{ '' + item.code.code + '' }}</view>
                    <view class="date-time">{{ '' + item.created_at + '' }}</view>
                </view>

                <view class="right">
                    <text v-if="item.code.code_type == 'coupon'">{{ '优惠券 - ' + (item.code.coupon && item.code.coupon.title) }}</text>
                    <block v-else>
                        <text v-if="item.code.code_type == 'chip'">
                            {{ (item.code.chip && item.code.chip.title) + '' }}
                            <text class="rightblue">{{ item.code.prize_total }}</text>
                            块
                        </text>
                        <block v-else>
                            <text v-if="item.code.code_type == 'score'">{{ scoreAlias + ' ' + item.code.score }}</text>
                            <block v-else>
                                <text v-if="item.code.code_type == 'redpack'">{{ '红包 ' + item.code.redpack / 100 + '元' }}</text>
                                <block v-else>
                                    <text v-if="item.code.code_type == 'exclude_card'">
                                        排除卡
                                        <text class="rightblue">{{ item.code.prize_total }}</text>
                                        张
                                    </text>
                                    <block v-else>
                                        <text v-if="item.code.code_type == 'show_card'">
                                            透视卡
                                            <text class="rightblue">{{ item.code.prize_total }}</text>
                                            张
                                        </text>
                                    </block>
                                </block>
                            </block>
                        </block>
                    </block>
                </view>
            </view>
        </view>
        <no-data @__l="__l" title="暂无兑换记录" vueId="63ddb0fc-1" v-if="$root.g0"></no-data>
    </view>
</template>

<script>
import noData from '@/components/NoData/NoData';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/code/record'],
    {
        '059d': function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return r;
            });
            n.d(e, 'c', function () {
                return u;
            });
            n.d(e, 'a', function () {
                return a;
            });
            var a = {
                NoData: function () {
                    return n.e('components/NoData/NoData').then(n.bind(null, 'cafe'));
                }
            };
            var r = function () {
                this.$createElement;
                var t = (this._self._c, !this.list.length && this.init);
                this.setData(
                    Object.assign(
                        {},
                        {
                            $root: {
                                g0: t
                            }
                        }
                    )
                );
            };
            var u = [];
        },
        '2cb1': function (t, e, n) {
            'use strict';

            (function (t) {
                var a = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var r = a(n('2eee'));
                var u = a(n('448a'));
                var i = a(n('c973'));
                var o = {
                    components: {},
                    data: function () {
                        return {
                            list: [],
                            total: 0,
                            page: 1,
                            per_page: 20,
                            init: false,
                            loading: false
                        };
                    },
                    computed: {
                        userInfo: function () {
                            return this.$store.getters.userInfo;
                        }
                    },
                    onLoad: function () {
                        var that = this;
                        return (0, i.default)(
                            r.default.mark(function n() {
                                var a;
                                var i;
                                return r.default.wrap(function (n) {
                                    for (;;) {
                                        switch ((n.prev = n.next)) {
                                            case 0:
                                                t.showLoading({
                                                    title: '加载中'
                                                });
                                                n.next = 3;
                                                return that.getList();
                                            case 3:
                                                i = n.sent;
                                                t.hideLoading();
                                                that.init = true;
                                                (a = that.list).push.apply(a, (0, u.default)(i.data.list));
                                                that.total = i.data.item_total;
                                            case 8:
                                            case 'end':
                                                return n.stop();
                                        }
                                    }
                                }, n);
                            })
                        )();
                    },
                    onReachBottom: function () {
                        var that = this;
                        return (0, i.default)(
                            r.default.mark(function e() {
                                var n;
                                var a;
                                return r.default.wrap(function (e) {
                                    for (;;) {
                                        switch ((e.prev = e.next)) {
                                            case 0:
                                                if (!that.loading) {
                                                    e.next = 2;
                                                    break;
                                                }
                                                return e.abrupt('return');
                                            case 2:
                                                that.loading = true;
                                                that.page++;
                                                e.next = 6;
                                                return that.getList();
                                            case 6:
                                                a = e.sent;
                                                that.loading = false;
                                                (n = that.list).push.apply(n, (0, u.default)(a.data.list));
                                            case 9:
                                            case 'end':
                                                return e.stop();
                                        }
                                    }
                                }, e);
                            })
                        )();
                    },
                    methods: {
                        getList: function () {
                            var that = this;
                            return (0, i.default)(
                                r.default.mark(function e() {
                                    return r.default.wrap(function (e) {
                                        for (;;) {
                                            switch ((e.prev = e.next)) {
                                                case 0:
                                                    e.next = 2;
                                                    return that.$http('/code-records', 'GET', {
                                                        page: that.page,
                                                        per_page: that.per_page
                                                    });
                                                case 2:
                                                    return e.abrupt('return', e.sent);
                                                case 3:
                                                case 'end':
                                                    return e.stop();
                                            }
                                        }
                                    }, e);
                                })
                            )();
                        }
                    }
                };
                e.default = o;
            }.call(this, n('543d').default));
        },
        '4b40': function (t, e, n) {
            'use strict';

            n.r(e);
            var a = n('2cb1');
            var r = n.n(a);
            for (var u in a) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return a[t];
                        });
                    })(u);
                }
            }
            e.default = r.a;
        },
        '694f': function (t, e, n) {
            'use strict';

            var a = n('d8da');
            n.n(a).a;
        },
        cba6: function (t, e, n) {
            'use strict';

            (function (t, e) {
                var a = n('4ea4');
                n('18ba');
                a(n('66fd'));
                var r = a(n('f9e2'));
                t.__webpack_require_UNI_MP_PLUGIN__ = n;
                e(r.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        },
        d8da: function (t, e, n) {},
        f9e2: function (t, e, n) {
            'use strict';

            n.r(e);
            var a = n('059d');
            var r = n('4b40');
            for (var u in r) {
                if (['default'].indexOf(u) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return r[t];
                        });
                    })(u);
                }
            }
            n('694f');
            var i = n('f0c5');
            var o = Object(i.a)(r.default, a.b, a.c, false, null, null, null, false, a.a, void 0);
            e.default = o.exports;
        }
    },
    [['cba6', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './record.css';
</style>
